package com.yonyou.isv.demo.openapi.api.message;

import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataArrayResponse;
import com.yonyou.isv.demo.openapi.api.BaseOpenApi;
import com.yonyou.isv.demo.openapi.api.OpenApiURL;
import com.yonyou.isv.demo.openapi.base.properties.OpenApiProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 根据appcode获取服务列表
 */
@Component
public class UspaceListApi extends BaseOpenApi {


    @Resource
    OpenApiProperties properties;

    /**
     * 根据appcode获取服务列表
     */
    public List<Map<String, Object>> list() {
        Map<String, String> params = new HashMap<>();
        params.put("appCode",properties.getAppCode());
        ApiDataArrayResponse apiDataResponse =  getForEntity(OpenApiURL.LIST_BY_APP_CODE,params, ApiDataArrayResponse.class);
        return getData(apiDataResponse);
    }

}
